package com.ru.application.creditscore.service;

@SuppressWarnings("serial")
public class ServiceException extends RuntimeException{
   
	private int code;
    
    public final static int CODE_PARAM_KO = 1;
    public final static String LIB_PARAM_KO = "The input parameters of the service are not valid.";
    
    public final static int CODE_CONNECTION_PB = 2;
    public final static String LIB_CONNECTION_PB = "Problem connecting to the database.";
    
    public final static int CODE_JPA_PB = 3;
    public final static String LIB_JPA_PB = "Problem in updating the database.";
    
    public final static int CODE_NOT_EXIST_EXC = 5;
    public final static String LIB_NOT_EXIST_EXC = "Data problem: Unknown object in the database.";
    
    
    /**
     * <p>
     * Contructor of exception service.
     * </p>
     * @param code error code.
     * @param message The error message associated with the exception.
     */
    public ServiceException(String message, int code){
        super(message);
        this.code = code;
    }
    

    /**
     * <p>
     * Contructor of exception service.
     * </p>
     * @param cause The cause of the error.
     */
    public ServiceException(Throwable cause){
        super(cause);
    }
    

    /**
     * <p>
     * Contructor of exception service.
     * </p>
     * @param code error code.
     * @param message The error message associated with the exception.
     * @param cause The cause of the error.
     */
    public ServiceException(String message, int code, Throwable cause){
        super(message, cause);
        this.code = code;
    }
    

    /**
     * GETTERS AND SETTERS
     */
    public int getCode(){
        return code;
    }
    

    public void setCode(int code){
        this.code = code;
    }
}